package cn.test;

import java.sql.ResultSet;
import java.sql.SQLException;

public class Demo1 {
	 static String sql = null;  
	    static DBHelper1 db1 = null;  
	   static int ret = 0;  
	   // static ResultSet ret =null;
	  
	    public static void main(String[] args) {  
	        //sql = "select * from c1";//SQL语句  
	    	sql = "insert into c1(name)values('lisi')";
	    	//sql = "DELETE FROM ceshi WHERE id = 1"; 
	        db1 = new DBHelper1(sql);//创建DBHelper对象  
	  
	        try {  
	           ret = db1.pst.executeUpdate(sql);//执行语句，得到结果集
	           System.out.println(ret);
	          /*  ret = db1.pst.executeQuery(sql);
	           while (ret.next()) {  
	                String id = ret.getString(1);  
	                String name = ret.getString(2);  
	               
	                System.out.println(id + "\t" + name );  
	            }//显示数据  
	            ret.close();  */
	            db1.close();//关闭连接  
	        } catch (SQLException e) {  
	            e.printStackTrace();  
	        }  
	    }  
}
